<!--
 * @Description: 
 * @Date: 2020-11-24 15:44:43
 * @LastEditors: lother
 * @LastEditTime: 2021-01-11 13:44:50
 * @FilePath: \AccounOpening-WEB\src\App.vue
-->
<template>
  <div id="app">
    <router-view v-if="isRouterAlive" />
  </div>
</template>

<script>
import {$icon} from '@/utils/index'
export default {
  name: "App",
  provide() {
    //父组件中通过provide来提供变量，在子组件中通过inject来注入变量。
    return {
      reload: this.reload,
    };
  },
  data() {
    return {
      isRouterAlive: true, //控制视图是否显示的变量
    };
  },
  created() {
    this.$store.dispatch(
      "app/setTableHeight",
      document.body.clientHeight - 280
    );
  },
  mounted() {
    if (!!window.ActiveXObject || "ActiveXObject" in window) {
      window.location.href = "./version.html";
    }
    $icon()
  },
  methods: {
    reload() {
      this.isRouterAlive = false; //先关闭，
      this.$nextTick(function () {
        this.isRouterAlive = true; //再打开
      });
    },
  },
};
</script>
